<?php
   class manageController extends platformController{
	   //新闻管理的控制器
	   //载入新闻列表
	   public function manageAction(){
		   $manage=new manageModel;
		   $rs=$manage->getAll();
		   require CURRENT_VIEW_PATH."news_manage.html";
	   }
	   //修改新闻的方法
	   public function updateAction(){
		   $model=new manageModel;
		   if(!empty($_POST)){
			  if($model->update()){
				  $this->jump("index.php?p=admin&c=manage&a=manage");
			  }else{
				  echo "修改新闻失败";
			  }
		  }
		   if(!isset($_GET['id'])){
			   return;
		   }
		   $id=$_GET['id'];
		   $data=$model->getById($id);
		   require CURRENT_VIEW_PATH."news_manage_update.html";
	   }
	   //删除新闻的方法
	   public function deleteAction(){
		   $model=new manageModel;
		   if(!isset($_GET['id'])){
			   return;
		   }
		   if($model->delete()){
			   $this->jump("index.php?p=admin&c=manage&a=manage");
		   }else{
			   echo "<script>alert('删除失败');history.back();</script>";
		   }
	   }
   }
?>